package com.yaowk.api.system.model;

import com.yaowk.api.common.BaseModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;

@Getter
@Setter
@ToString
public class Menu extends BaseModel<Integer> {

    private String name;
    private String description;
    @ApiModelProperty("前端路径")
    private String url;
    @ApiModelProperty("上级id")
    private Integer parentId;
    private Integer sort;
    private Byte status;
    @ApiModelProperty("资源类型,1-菜单,2-按钮,3-隐性权限")
    private Byte type;
    private Date createTime;

    @Override
    public int compareTo(Object obj) {
        Menu menu = (Menu) obj;
        int sort = getSort().compareTo(menu.getSort());
        sort = sort > 0 ? -1 : getId().compareTo(menu.getId());
        return sort;
    }
}
